set(IMGUI_HEADERS
    src/imconfig.h
    src/imgui_internal.h
    src/imgui.h
    src/imstb_rectpack.h
    src/imstb_textedit.h
    src/imstb_truetype.h    
    src/backends/imgui_impl_glfw.h
    src/backends/imgui_impl_opengl3.h
    src/backends/imgui_impl_opengl3_loader.h
    src/misc/cpp/imgui_stdlib.h
)

set(IMGUI_SRC
    src/imgui_demo.cpp
    src/imgui_draw.cpp
    src/imgui_tables.cpp
    src/imgui_widgets.cpp
    src/imgui.cpp
    src/backends/imgui_impl_glfw.cpp
    src/backends/imgui_impl_opengl3.cpp
    src/misc/cpp/imgui_stdlib.cpp
)

find_package(OpenGL REQUIRED)

add_library(imgui ${IMGUI_HEADERS} ${IMGUI_SRC})
if(MSVC)
  target_compile_options(imgui PRIVATE /W4 /WX /arch:AVX2 /fp:fast)
endif()
target_link_libraries(imgui PUBLIC glfw glad OpenGL::GL)
target_compile_definitions(imgui PRIVATE IMGUI_DLL_EXPORT)
target_sources(imgui PRIVATE  ${IMGUI_SRC} ${IMGUI_HEADERS})
target_include_directories(imgui  PUBLIC  src/ src/examples src/examples/libs/glfw src/backends src/misc/cpp)
